package com.xls.future.listener;

import android.support.annotation.Nullable;
import android.util.Log;

import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.xls.future.bmob.BmobUtil;
import com.xls.future.utils.LogUtil;

/**
 * Created by Administrator on 2017/9/12.
 */

public class LoadImageListener<R> implements RequestListener<R> {

    private static String TAG ="LoadImageListener";

    @Override
    public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<R> target, boolean isFirstResource) {
        LogUtil.e(TAG,"onLoadFailed  model ="+model.toString()+" | isFirstResource="+isFirstResource);
        BmobUtil.recordErrorCount(model.toString());
        return false;
    }

    @Override
    public boolean onResourceReady(R resource, Object model, Target<R> target, DataSource dataSource, boolean isFirstResource) {
        LogUtil.d(TAG,"onResourceReady  model ="+model+" | dataSource= "+dataSource+" | isFirstResource="+isFirstResource);
        return false;
    }
}
